Skip to content

Conversation

@ponagehl2
Copy link
Collaborator

Modified Sources.SuperK methods. 1. Added some if statements for checking IP inputs. Deleted redundant code for setting up the GUI for setting laser parameters.

function set.ip(obj,val)
err = [];
if strcmp(val,'No Server')
error('Intentional error out');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you error here, you don't get to the next lines of code. Also if the user is intending to type No Server, there is no reason to provide an error message since it is intentional. I would delete this line entirely.

return
end
if isempty(val)
error('No IP address inputed');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue here, your error will prevent the rest of the code from happening. In this case you can set obj.ip as you do in the next line then error instead of return.

@mwalsh161
Copy link
Owner

Make sure you delete any existing old instance before changing the ip and setting a new instance of the hwserver.

% help_text - provide longer text to describe what this pref does (think tooltip)
% readonly - boolean specifying if GUI control should be editable (e.g. "enabled")
% display_only - boolean specifying if saved as pref when module unloaded
% tag - any data type available for user to choose (similar to gobject UserData)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can be useful to store any additional data to make it easier on callbacks. I would push to call it UserData instead since that is literally what @ponagehl2 compare it to.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the set methods should all be 'setNum'? Currently set == tag for each one. I don't really like this solution, especially because if you want to be pedantic, you would have to provide tags or a system to interpret tags for each function (clean, validate, etc). Perhaps a more elegant solution is to pass a cell array {'setNum', 'setPower'} and then have pref_handler parse and insert it upon function handle construction. I also don't think it's terrible to have a separate function for each one.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t disagree, but having this option can be quite handy. Not the worst to have a single set method for many properties. Perhaps the usage of it can be improved in this context, but I do like the added freedom it gives developers.

@ichristen
Copy link
Collaborator

Hey @ponagehl2 , what's the status of the SuperK and this branch? Would be great to merge this in!

@ichristen
Copy link
Collaborator

Hey @ponagehl2 , just checking in on this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants